//导入自己的css
require('../css/jogging.less');
window.addEventListener('load',function(){

     //生成底部
    common.footer('jogging')


    // 获取dom
    let min = this.document.querySelector('.min')
    let ka = this.document.querySelector('.ka')
    let geshu = this.document.querySelector('.geshu')
    let cishu = this.document.querySelector('.cishu')
    let userId = this.localStorage.getItem('userId');
   function getHomeData(){
    $http.get('/headPageInfo',{userId},function(res){
        min.textContent = res.data.rank;
        ka.textContent = res.data.punchIn;
        geshu.textContent = res.data.insigniaNum;
        if(res.data.isPunch == 'true'){
            cishu.style.display = 'none'
        }else{
            cishu.style.display = 'biock'
        }
    })
   }
    getHomeData()
    // 打卡按钮
    cishu.addEventListener('click',function(){
        $http.get('/clockIn',{userId},function(res){
            if(res.status ==0){
                common.toast(1,'打卡成功')
                getHomeData();
            }else{
                common.toast(0,res.msg)
            }
        })
    })
    var mySwiper = new swiper ('.swiper-container', {  
    // direction: 'vertical', // 垂直切换选项
        loop: true, // 循环模式选项
        
        freeMode: true,
        // 如果需要分页器
        pagination: {
          el: '.swiper-pagination',
        },


        autoplay: {
            stopOnLastSlide: true,
          },
      })   
})
